package mysql;

import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.tuple.Fields;
import redis.WordSpout;

public class PersistentWordCount {
    public static void main(String[] args) throws Exception {
        WordSpout wordSpout = new WordSpout();
        WordCountBolt wordCountBolt = new WordCountBolt();

        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("wordSpout", wordSpout);
        builder.setBolt("wordCountBolt", wordCountBolt).fieldsGrouping("wordSpout", new Fields("word"));

        Config config = new Config();
        LocalCluster localCluster = new LocalCluster();
        localCluster.submitTopology("jdbc-topology", config, builder.createTopology());
    }
}
